package online.sanen.mhdt.entity;

/**
 * 人物属性点
 * init:初始点数,allot:已分配点数
 * @author Administrator
 */
public class AttrPoint {
	/** 可用分配电 */
	private int allotPoint;
	/**力量*/
	private int str;
	private int strInit;
	private int strAllot;
	/**魔力*/
	private int mag;
	private int magInit;
	private int magAllot;
	/**体质*/
	private int con;
	private int conInit;
	private int conAllot;
	/**耐力*/
	private int vit;
	private int vitInit;
	private int vitAllot;
	/**敏捷*/
	private int agi;
	private int agiInit;
	private int agiAllot;

	/**当前分配(但还未确认点数)*/
	private int strTemp;
	private int magTemp;
	private int conTemp;
	private int vitTemp;
	private int agiTemp;
	private Hero hero;
	/**
	 * 升级获得属性分配点数量
	 */
	private int levelPoint=5;
	public AttrPoint() {
	}
	public AttrPoint(Hero hero) {
		this.hero=hero;
	}
	public void countAllotPoint(){
		this.allotPoint=hero.getLevel()*levelPoint-(this.strAllot+this.magAllot+this.conAllot+this.vitAllot+this.agiAllot);
	}
	/**
	 * 统计属性点
	 */
	public void countAttr(){
		this.str=this.strAllot+this.strTemp+this.strInit+hero.getLevel();
		this.mag=this.magAllot+this.magTemp+this.magInit+hero.getLevel();
		this.con=this.conAllot+this.conTemp+this.conInit+hero.getLevel();
		this.vit=this.vitAllot+this.vitTemp+this.vitInit+hero.getLevel();
		this.agi=this.agiAllot+this.agiTemp+this.agiInit+hero.getLevel();
		//刷新属性
		this.hero.getHeroAttr().refreshAttr();
	}
	/**
	 * 当前属性点分配确认(分配属性点确认按钮调用方法)
	 */
	public void confirmAllotAttrPoint() {
		this.strAllot+=this.strTemp;
		this.magAllot+=this.magTemp;
		this.conAllot+=this.conTemp;
		this.vitAllot+=this.vitTemp;
		this.agiAllot+=this.agiTemp;
		countAllotPoint();
		this.strTemp=0;
		this.magTemp=0;
		this.conTemp=0;
		this.vitTemp=0;
		this.agiTemp=0;
		countAttr();
	}
	/**
	 * 当前属性点分配取消(进入战斗时,需调用此方法)
	 */
	public void cancelAllotAttrPoint() {
		countAllotPoint();
		this.strTemp=0;
		this.magTemp=0;
		this.conTemp=0;
		this.vitTemp=0;
		this.agiTemp=0;
		countAttr();
	}
	//分配属性点方法(increase增加一点,decrease减少一点)
	public void increaseStrTemp() {
		if(allotPoint>0) {
			this.strTemp++;
			this.allotPoint--;
			countAttr();
		}
	}
	public void decreaseStrTemp() {
		if(this.strTemp>0) {
			this.strTemp--;
			this.allotPoint++;
			countAttr();
		}
	}
	public void increaseMagTemp() {
		if(allotPoint>0) {
			this.magTemp++;
			this.allotPoint--;
			countAttr();
		}
	}
	public void decreaseMagTemp() {
		if(this.magTemp>0) {
			this.magTemp--;
			this.allotPoint++;
			countAttr();
		}
	}

	public void increaseConTemp() {
		if(allotPoint>0) {
			this.conTemp++;
			this.allotPoint--;
			countAttr();
		}
	}

	public void decreaseConTemp() {
		if(this.conTemp>0) {
			this.conTemp--;
			this.allotPoint++;
			countAttr();
		}
	}
	public void increaseVitTemp() {
		if(allotPoint>0) {
			this.vitTemp++;
			this.allotPoint--;
			countAttr();
		}
	}

	public void decreaseVitTemp() {
		if(this.vitTemp>0) {
			this.vitTemp--;
			this.allotPoint++;
			countAttr();
		}
	}
	public void increaseAgiTemp() {
		if(allotPoint>0) {
			this.agiTemp++;
			this.allotPoint--;
			countAttr();
		}
	}
	public void decreaseAgiTemp() {
		if(this.agiTemp>0) {
			this.agiTemp--;
			this.allotPoint++;
			countAttr();
		}
	}


	//--------------get and set-------------------
	public int getAllotPoint() {
		return allotPoint;
	}
	public void setAllotPoint(int allotPoint) {
		this.allotPoint = allotPoint;
	}
	public int getStr() {
		return str;
	}
	public void setStr(int str) {
		this.str = str;
	}
	public int getStrInit() {
		return strInit;
	}
	public void setStrInit(int strInit) {
		this.strInit = strInit;
	}
	public int getStrAllot() {
		return strAllot;
	}
	public void setStrAllot(int strAllot) {
		this.strAllot = strAllot;
	}
	public int getMag() {
		return mag;
	}
	public void setMag(int mag) {
		this.mag = mag;
	}
	public int getMagInit() {
		return magInit;
	}
	public void setMagInit(int magInit) {
		this.magInit = magInit;
	}
	public int getMagAllot() {
		return magAllot;
	}
	public void setMagAllot(int magAllot) {
		this.magAllot = magAllot;
	}
	public int getCon() {
		return con;
	}
	public void setCon(int con) {
		this.con = con;
	}
	public int getConInit() {
		return conInit;
	}
	public void setConInit(int conInit) {
		this.conInit = conInit;
	}
	public int getConAllot() {
		return conAllot;
	}
	public void setConAllot(int conAllot) {
		this.conAllot = conAllot;
	}
	public int getVit() {
		return vit;
	}
	public void setVit(int vit) {
		this.vit = vit;
	}
	public int getVitInit() {
		return vitInit;
	}
	public void setVitInit(int vitInit) {
		this.vitInit = vitInit;
	}
	public int getVitAllot() {
		return vitAllot;
	}
	public void setVitAllot(int vitAllot) {
		this.vitAllot = vitAllot;
	}
	public int getAgi() {
		return agi;
	}
	public void setAgi(int agi) {
		this.agi = agi;
	}
	public int getAgiInit() {
		return agiInit;
	}
	public void setAgiInit(int agiInit) {
		this.agiInit = agiInit;
	}
	public int getAgiAllot() {
		return agiAllot;
	}
	public void setAgiAllot(int agiAllot) {
		this.agiAllot = agiAllot;
	}

}
